
'unit tests for tgrid2d

Type testGrid Extends TTest

	Field w:TGadget
	Field c:TGadget

	Field g:TGrid2D
	
	
	Method MockWindow()
		w = CreateWindow("test",0,0,400,400,Null, WINDOW_HIDDEN | WINDOW_CLIENTCOORDS)
		c = CreateCanvas(0,0,400,400, w)
	End Method
	
	
	Method SetUp() {before}
		g = New TGrid2D
	End Method
	
	Method CleanUp() {after}
		g = Null
	End Method
	
	Method Constructor() {test}
		assertNotNull(g)
		assertNotNull(g.mouseGridPosition)
		assertNotNull(g.prev_MouseGridPosition)
		assertNotNull(g.mouseCanvasPosition)
		assertNotNull(g.prev_MouseCanvasPosition)
		assertNotNull(g.renderOffset)
	End Method	
	
	Method DefaultSettings() {test}
		assertEqualsI(2, g.GetZoomLevel())
		assertEqualsI(8, g.GetGridSize())
		assertEqualsI( GRID_RENDER_LINES, g.renderMethod)
	End Method
	
	Method SetAndGetLabel() {test}
		g.SetLabel("yo")
		assertEquals("yo", g.GetLabel())
	End Method
	
	
	
'	'can we change zoom
'	Method testZoom() {test}
'		g.ChangeZoom(5)
'		
'		'default zoom is 6
'		assertEqualsI(11, g.zoomLevel)
'	End Method
'	
'	'can we increase grid
'	Method testIncreaseGrid() {test}
'		g.IncreaseGrid()
'
'		'max size is 8
'		assertEqualsI(8, g.gridSize)
'	End Method
'	
'	'can we decrease grid
'	Method testDecreaseGrid() {test}
'		g.DecreaseGrid()
'
'		'default size is 8
'		assertEqualsI(4, g.gridSize)
'	End Method
'	
'	'can we move grid
'	Method testMoveGrid() {test}
'	
'		Local v:TVector2D = TVector2D.Create(10,15)
'	
'		g.Move(v)
'		
'		assertEqualsI(10, g.renderOffset.x)
'		assertEqualsI(15, g.renderOffset.y)
'	End Method
'	
'	'can we set visible flag
	Method testSetVisible() {test}
		g.SetVisible(False)
		assertFalse(g.GetVisible())
	End Method	
	
End Type
